package com.erlin.common.api;

import com.erlin.platform.entity.ElUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Getter
@Setter
@ApiModel("用户信息返回对象")
public class UserInfoVo implements Serializable {
    @ApiModelProperty("用户mid")
    private String mid;
    @ApiModelProperty("用户名")
    private String username;
    @ApiModelProperty("头像图片")
    private String icon;
    @ApiModelProperty("邮箱")
    private String email;
    @ApiModelProperty("昵称")
    private String nickName;
    @ApiModelProperty("电话号码")
    private String phoneNum;
    @ApiModelProperty("微信openId")
    private String openId;
    @ApiModelProperty("用户类别 ADMIN平台，CUSTOMER顾客，BUSINESSMAN商户")
    private String userClas;
    @ApiModelProperty("token")
    private String token;

    public static UserInfoVo from(ElUser user){
        UserInfoVo userInfoVo = new UserInfoVo();
        BeanUtils.copyProperties(user,userInfoVo);
        return userInfoVo;
    }
}
